<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
if($_SESSION['merchid']){
	$merchid=$this->checklogin();
	unset($_SESSION['merchid']);
}else{
	$merchid=pdo_getcolumn('jy_tour_merch',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']),'id');
	if(!$merchid){
		$info=pdo_get('core_members',array('id'=>$_SESSION['uid']),array('mobile','nickname','realname'));
		pdo_insert('jy_tour_merch',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'status'=>1,'jointime'=>time(),'realname'=>$info['realname'],'mobile'=>$info['mobile'],'merchname'=>$info['nickname']));
		$merchid=pdo_insertid();
	}
}

$return['item']=pdo_get('jy_tour_merch',array('id'=>$merchid,'uniacid'=>$_SESSION['uniacid']));
$return['status1']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'merchid'=>$merchid,'status'=>1));
$return['status2']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'merchid'=>$merchid,'status'=>2));
$return['ispay']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'merchid'=>$merchid,'ispay'=>0));
$return['goods']=pdo_count('jy_weishop_goods',array('uniacid'=>$_SESSION['uniacid'],'merchid'=>$merchid));
set_html('header','common/header');
exi($return);